from sqlalchemy import (Table, Column, String, DateTime, Date, Integer,
        Boolean, DECIMAL, Unicode, ForeignKey, and_, or_)
from turbogears.database import metadata, session
from sqlalchemy.orm import mapper, relation
from datetime import datetime

# from turbogears import identity 

task_table = Table('task_tbl', metadata,
        Column('task_id', Integer, primary_key=True),
        Column('name', String(200), nullable=False),
        Column('description', String),
        Column('completed', Boolean),
        Column('context_id', Integer, ForeignKey('context_tbl.context_id')),
        Column('project_id', Integer, ForeignKey('project_tbl.project_id')),
        Column('created_on', DateTime, default=datetime.now),
        Column('completed_on', DateTime, default=None),
     )
class Task(object):
    pass
mapper(Task, task_table)

context_table = Table('context_tbl', metadata,
        Column('context_id', Integer, primary_key=True),
        Column('name', String(100), nullable=False),
     )
class Context(object):
    pass
mapper(Context, context_table)

project_table = Table('project_tbl', metadata,
        Column('project_id', Integer, primary_key=True),
        Column('name', String(100), nullable=False),
        Column('description', String),
        Column('completed', Boolean),
        Column('created_on', DateTime, default=datetime.now),
        Column('completed_on', DateTime, default=None),
     )
class Project(object):
    pass
mapper(Project, project_table)

tasknote_table = Table('tasknote_tbl', metadata,
        Column('tasknote_id', Integer, primary_key=True),
        Column('note', String, nullable=False),
        Column('task_id', Integer, ForeignKey('task_tbl.task_id')),
        Column('created_on', DateTime, default=datetime.now),
        Column('edited_on', DateTime, default=datetime.now),
     )
class TaskNote(object):
    pass
mapper(TaskNote, tasknote_table)

projectnote_table = Table('projectnote_tbl', metadata,
        Column('projectnote_id', Integer, primary_key=True),
        Column('note', String, nullable=False),
        Column('project_id', Integer, ForeignKey('project_tbl.project_id')),
        Column('created_on', DateTime, default=datetime.now),
        Column('edited_on', DateTime, default=datetime.now),
     )
class ProjectNote(object):
    pass
mapper(ProjectNote, projectnote_table)

class User:
    pass
class Group:
    pass
class Permission:
    pass
class Visit:
    pass
